package com.example.auth.controller;

import com.example.auth.service.IAuthService;
import com.example.common.api.ResultUtil;
import com.nimbusds.jose.JOSEException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;
import java.util.concurrent.ExecutionException;

@RestController
@Slf4j
@RequestMapping("/api/auth")
public class AuthController {

    @Resource
    private IAuthService authService;

    @RequestMapping(value = "/token", method = RequestMethod.POST)
    public ResultUtil postToken(@RequestParam Map<String, String> params) throws JOSEException, ExecutionException, InterruptedException {
        return authService.createToken(params);
    }
}
